﻿using Microsoft.Extensions.DependencyInjection;
using Modules.Project.Repositories;
using PmSoft;

namespace Modules.Project
{
    [UseDI(ServiceLifetime.Scoped)]
    public class ProjectSecurityDepositPaymentDetailsService
    {
        private readonly ProjectSecurityDepositPaymentDetailsRepository projectSecurityDepositPaymentDetailsRepository;

        public ProjectSecurityDepositPaymentDetailsService(ProjectSecurityDepositPaymentDetailsRepository projectSecurityDepositPaymentDetailsRepository)
        {
            this.projectSecurityDepositPaymentDetailsRepository = projectSecurityDepositPaymentDetailsRepository;
        }

        public IPagedList<ProjectSecurityDepositPaymentDetails> GetProjectSecurityDepositPayments(ProjectSecurityDepositPaymentDetailsQuery query, int pageIndex, int pageSize)
        {
            return projectSecurityDepositPaymentDetailsRepository.GetProjectSecurityDepositRecords(query, pageIndex, pageSize);
        }

        public ProjectSecurityDepositPaymentDetails? GetProjectSecurityDepositPayment(int id)
        {
            return projectSecurityDepositPaymentDetailsRepository.Get(id);
        }

        public void Create(ProjectSecurityDepositPaymentDetails entity)
        {
            projectSecurityDepositPaymentDetailsRepository.Insert(entity);
        }

        public void Update(ProjectSecurityDepositPaymentDetails entity)
        {
            projectSecurityDepositPaymentDetailsRepository.Update(entity);
        }

        public void Delete(int id)
        {
            projectSecurityDepositPaymentDetailsRepository.DeleteByEntityId(id);
        }

        public void Deleted(IEnumerable<int> ids)
        {
            foreach (var id in ids)
            {
                Delete(id);
            }
        }
    }
}